package org.javaboy.vhr.controller.emp;

import org.javaboy.vhr.model.Evaluation;
import org.javaboy.vhr.model.RespBean;
import org.javaboy.vhr.model.RespPageBean;
import org.javaboy.vhr.model.SendResume;
import org.javaboy.vhr.service.SendResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/sendResume")
public class SendResumeController {
    @Autowired
    SendResumeService sendResumeService;
    @GetMapping("/")
    public RespPageBean getSendResume(SendResume sendResume,@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
        return sendResumeService.getSendResume(sendResume,page,size);
    }
    @PostMapping("/add")
    public RespBean addSendResume(@RequestBody SendResume sendResume) {
        if (sendResumeService.addSendResume(sendResume)==1) {
            return RespBean.ok("添加成功!");
        }
        return RespBean.error("添加失败!");
    }
    @PutMapping("/update")
    public RespBean updateByEvaluationId(@RequestBody SendResume sendResume){
        if(sendResumeService.updateSendResume(sendResume) == 1){
            return RespBean.ok("更新成功");
        }
        return RespBean.error("更新失败");
    }

    @DeleteMapping("/delete")
    public RespBean deleteByEvaluationId(@RequestParam Integer id){
        if(sendResumeService.deleteSendResume(id) == 1){
            return RespBean.ok("删除成功");
        }
        return RespBean.error("删除失败");
    }
}
